<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>客户逾期历史表 管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">客户ID</div>
                    <div class="field">
                        <input name="cstId" id="cstId" type="text" class="ui-textbox" validate="{number:true}" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">客户名称</div>
                    <div class="field">
                        <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">支付表ID</div>
                    <div class="field">
                        <input name="paySchId" id="paySchId" type="text" validate="{number:true}" class="ui-textbox"
                               value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">支付表号</div>
                    <div class="field">
                        <input name="paySchNo" id="paySchNo" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null, callback = null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/capital/capOverdueHis/initList.do',
            method: 'get',
            columns: [
                {display: '客户ID', name: 'cstId', minWidth: 80, align: 'left', enabledSort: false},
                {display: '客户名称', name: 'cstNm', minWidth: 80, align: 'left', enabledSort: false},
                {display: '支付表ID', name: 'paySchId', minWidth: 100, align: 'left', enabledSort: false},
                {display: '支付表号', name: 'paySchNo', minWidth: 170, align: 'left', enabledSort: false},
                {display: '期次', name: 'payPd', minWidth: 50, align: 'left', enabledSort: false},
                {
                    display: '逾期日期',
                    name: 'overdueDate',
                    minWidth: 100,
                    align: 'left',
                    enabledSort: false,
                    render: renderDate
                },
                {display: '逾期天数', name: 'overdueDay', minWidth: 60, align: 'left', enabledSort: false},
                {
                    display: '逾期租金', name: 'overdueAmount', minWidth: 80, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.overdueAmount / 100);
                    }
                },
                {
                    display: '罚息金额', name: 'penaltyAmount', minWidth: 80, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.penaltyAmount / 100);
                    }
                },
                {
                    display: '已支付金额', name: 'payAmount', minWidth: 80, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.payAmount / 100);
                    }
                },
                /*{display: '当日实收罚息金额', name: 'actualAmount', minWidth: 100, align: 'left', enabledSort: false},
                 {display: '实收累计金额(已核销罚息总金额)', name: 'totalAmount', minWidth: 100, align: 'left', enabledSort: false},*/
                {
                    display: '减免金额', name: 'reduAmount', minWidth: 80, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.reduAmount / 100);
                    }
                },
                {
                    display: '数据状态', name: 'dataStatusCd', minWidth: 50, align: 'left', enabledSort: false,
                    render: function (rowdata, index, value) {
                        if (value == "0") {
                            return "最新";
                        } else {
                            return "过期";
                        }
                    }
                },
                {
                    display: '支付状态', name: 'overdueStatusCd', minWidth: 100, align: 'left', enabledSort: false,
                    render: function (rowdata, index, value) {
                        if (value == "0") {
                            return "未支付";
                        } else if (value == "1") {
                            return "部分支付";
                        } else {
                            return "已支付";
                        }
                    }
                },
                //{display: '所属事业部', name: 'buOrgCdNm', minWidth: 100, align: 'left', enabledSort: false},
                {
                    display: '罚息日期',
                    name: 'createDate',
                    minWidth: 100,
                    align: 'left',
                    enabledSort: false,
                    render: renderDate
                },
                {
                    display: '逾期本金', name: 'overduePrincipal', minWidth: 100, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.overduePrincipal / 100);
                    }
                },
                {
                    display: '逾期利息', name: 'overdueInterest', minWidth: 100, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.overdueInterest / 100);
                    }
                },
                {
                    display: '已核销本金', name: 'paidUpPrincipal', minWidth: 100, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.paidUpPrincipal / 100);
                    }
                },
                {
                    display: '已核销利息', name: 'paidUpInterest', minWidth: 100, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.paidUpInterest / 100);
                    }
                },
                {
                    display: '已核销其他费用', name: 'paidUpOther', minWidth: 100, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.paidUpOther / 100);
                    }
                },
                {
                    display: '剩余本金', name: 'remainingPrincipal', minWidth: 100, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.remainingPrincipal / 100);
                    }
                },
                {
                    display: '剩余利息', name: 'remainingInterest', minWidth: 100, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.remainingInterest / 100);
                    }
                },
                {
                    display: '剩余其他费用', name: 'remainingOther', minWidth: 100, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.remainingOther / 100);
                    }
                },
                {display: '累计逾期期次', name: 'totalPayPd', minWidth: 100, align: 'left', enabledSort: false},
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: true,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false,
            delayLoad: true
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            form = liger.get("searchBar");
            var data = form.getData();
            var qt = "";
            for (name in data) {
                if (data[name]) {
                    qt = "ok";
                }
                grid.setParm(name, data[name]);
            }
            if (qt) {
                grid.reload();
                qt = "";
            } else {
                $.ligerDialog.SQalert({content: "请输入查询条件", SQ_type: "warning"});
            }
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            clearLigerForm("searchBar");
        });


    });

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }
</script>

</body>
</html>
